package com.hex.ds.hdrs.warn.service;

import com.hex.bigdata.hbda.base.Page;
import com.hex.ds.hdrs.common.utils.BaseUtil;
import com.hex.ds.hdrs.common.utils.MapUtil;
import com.hex.ds.hdrs.warn.dao.WarnSendLogDao;
import com.hex.ds.hdrs.warn.dto.WarnSendLogDto;
import com.hex.ds.hdrs.warn.po.WarnSendLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Slf4j
@Service
public class WarnSendLogService {

    @Autowired
    private WarnSendLogDao warnSendLogDao;

    /**
     * @Method: insert
     * @Param: [warnSendLog]
     * @Return: void
     * @Description: 新增告警发送日志
     * @Author: ji.tang
     * @Date: 2022/4/28 17:51
     * @Version: V1.0
     */
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    public void insert(WarnSendLog warnSendLog){
        this.warnSendLogDao.insert(warnSendLog);
    }


    /**
     * @Method: selectPages
     * @Param: [warnSendLog, page]
     * @Return: java.lang.Object
     * @Description: 分页查询告警发送日志
     * @Author: ji.tang
     * @Date: 2022/9/2 9:28
     * @Version: V1.0
     */
    public List<WarnSendLogDto> selectPages(WarnSendLog warnSendLog, Page page) {
        Map map = MapUtil.Entity2Map(warnSendLog);
        return this.warnSendLogDao.selectPages(map,page);
    }
}
